package com.zeen.wima.proxy;

import java.util.ArrayList;

import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;

import com.zeen.wima.common.Ad;
import com.zeen.wima.common.HttpCallback;
import com.zeen.wima.common.Wima;

public class AdProxy extends ProxyBase {

	public static String CLASS = "com.zeen.iphone.proxy.AdProxy";

	public final static int LOADED = 0;

	public AdProxy() {
		super();
	}

	public void get(String uid) {
		ArrayList<NameValuePair> param = new ArrayList<NameValuePair>();
		param.add(new BasicNameValuePair("devId", uid));
		sendRequest(url, "getAd", param, "", new HttpCallback() {
			@Override
			public void onResponse(String state, String msg, JSONArray data) {
				if (msg.equals("rs_ad_data")) {
					try {
						Ad ad = new Ad(data.getString(0), data.getString(1));
						Wima.getInstance().setLastAd(ad);
					} catch (Exception e) {

					}
				}
			}
		});
	}
}
